<template>
    <h1>Home</h1>
    <p>{{userStore.state.token}}</p>
    <el-button type="primary" @click="requestUserList">请求用户列表</el-button>
    <el-button type="primary" @click="logout">退出</el-button>
</template>
<script setup lang="ts">
import {useUserStore} from '@/stores/user';
import {fetchUserList} from '@/api/user';
const userStore = useUserStore();
const requestUserList = async ()=>{
    const response = await fetchUserList();
    console.log(response);
}
const logout = ()=>{
    userStore.toLogout();
    window.location.reload();
}
</script>